<!DOCTYPE html>
<html>
<head>
    <title>${title} - ${siteName} - 中立的小说排名、评分网站</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="${title},好看的小说,小说排行">
    <meta name="description" content="${title}">
    <meta name="author" content="${siteName}">
    <base href="${serverUri}"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/png" sizes="32x32" href="icon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="icon/favicon-16x16.png">
    <link rel="stylesheet" href="admin/plugins/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="css/ionicons/2.0.1/ionicons.min.css">
    <link rel="stylesheet" href="admin/plugins/datatables-bs4/css/dataTables.bootstrap4.css">
    <link rel="stylesheet" href="admin/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
    <link rel="stylesheet" href="admin/plugins/tipped/css/tipped.css">
    <link rel="stylesheet" href="admin/plugins/toastr/toastr.css">
    <link rel="stylesheet" href="admin/plugins/jquery-realperson/jquery.realperson.css">
    <link rel="stylesheet" href="admin/css/adminlte.min.css">
    <link rel="stylesheet" href="css/mainpage.css">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<body class="hold-transition layout-top-nav" style="background: #b3b3b3;">
<div class="wrapper">
    <div class="modal fade" id="modal-secondary" style="display: none;" aria-hidden="true">
        <div class="modal-dialog" id="modal-dialog-message">
            <div class="modal-content bg-secondary">
                <div class="modal-header">
                    <h6 class="modal-title">编辑消息</h6>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="modal-body">
                    <textarea class="form-control" rows="3" placeholder="输入要发的消息" id="fiction-message-content"></textarea>
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-outline-light" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-outline-warning" onclick="fictionOnSendMessage();">发送</button>
                </div>
            </div>
        </div>
    </div>
    <#--  nav bar  -->
    <#include "./header.ftl">

    <div id="content-frame" class="content-wrapper">
        <div class="row">
            <#--  left column  -->
            <div class="col-lg-2" style="background: #b3b3b3;">

            </div>
            <#--  middle column  -->
            <div class="col-lg-8 col-sm-12">
                <div class="content-header">
                    <div class="container-fluid">
                        <div class="row mb-2">
                            <div class="col-6">
                                <h1><i class="fa fa-bookmark text-maroon mr-3 d-none d-md-inline"></i><strong style="color: #146cb2;">${title}</strong><span
                                            class="ml-2 d-none d-md-inline">(${finishyear})</span></h1>
                            </div>
                            <div class="col-6">
                                <h1 class="float-right">
                                    <i class="fa fa-star star-gold mr-2 d-none d-md-inline"></i>
                                    <#if isScoreValid>
                                        <span class="mr-2 text-gray pffontext">${score}</span>
                                    <#else>
                                        <span class="mr-2 text-gray"><span class="d-none d-md-inline">离最少票数</span>差${voteDiff}票</span>
                                    </#if>
                                    <span style="cursor: pointer;" onclick="fictionOnIWantToScoreClick(this);">
                                        <i class="far fa-star text-gray mr-2 pl-2" style="border-left: 1px solid darkgrey;"></i>
                                        <span class="d-none d-md-inline" style="font-size: 1.2rem;">
                                            <#if (myScore > 0)>
                                                ${myScore}
                                            <#else>
                                                我要评分
                                            </#if>
                                        </span>
                                    </span>
                                </h1>
                            </div>
                        </div>
                    </div>
                </div>
                <section class="content">
                    <div class="card">
                        <div class="card-header">
                            <i class="fas fa-user-circle mr-2"></i>作者：<strong><a href="${authorLink}">${author}</a></strong>
                        </div>

                        <div class="card-body">
                            ${description}
                        </div>

                        <div class="card-footer" fictionid="${fictionid}" id="fiction-id-container">
                            <h6>
                                <span class="d-none d-md-inline"><i class="fas fa-book mr-2"></i>推荐分类：${catlog}</span>
                                <span class="float-right">
                                    <span>
                                        <#if (audioInfos?size >0)>
                                            <i id="audio-icon" class="fa fa-headphones mr-5 text-yellow" aria-hidden="true"></i>
                                                <label id="hidden-label-audio" hidden>
                                                <#list audioInfos as info>
                                                    ${info_index+1}:<strong>${info[1]}</strong>,${info[0]}|
                                                </#list>
                                                </label>
                                        <#else>
                                            <i id="audio-icon" class="fa fa-headphones mr-5" aria-hidden="true"></i>
                                        </#if>

                                        <#if (movieInfos?size >0)>
                                            <i id="movie-icon" class="fa fa-film mr-5 text-yellow" aria-hidden="true" hidden></i>
                                        <#else>
                                            <i id="movie-icon" class="fa fa-film mr-5" aria-hidden="true" hidden></i>
                                        </#if>
                                    </span>

                                    <#if collected>
                                        <span class="mr-3" onclick="fictionOnCollectClick(this);" style="cursor: pointer;">
                                            <i class="fa fa-heart mr-2 collect-enable" aria-hidden="true"></i>收藏
                                        </span>
                                    <#else>
                                        <span class="mr-3" onclick="fictionOnCollectClick(this);" style="cursor: pointer;">
                                            <i class="fa fa-heart mr-2 collect-disable" aria-hidden="true"></i>收藏
                                        </span>
                                    </#if>
                                </span>
                            </h6>
                        </div>
                    </div>

                    <div class="card">
                        <div class="card-header">
                            <i class="far fa-hdd mr-2"></i>作者其他作品
                        </div>
                        <#if (otherArticleList?size > 0)>
                            <div class="card-body">
                                <#assign rowCount = (otherArticleList?size / 4)?int>
                                <#assign index = 0>
                                <#if (rowCount >= 1)>
                                    <#list 1 .. rowCount as i>
                                        <div class="row">
                                            <#list 1 .. 4 as j>
                                                <div class="col-lg-3 col-md-12">
                                                    <a href="fiction/${otherArticleList[index][0]}" class="mr-5">${otherArticleList[index][1]}(<span class="pffontext">${otherArticleList[index][2]}</span>)</a>
                                                </div>
                                                <#assign index = index + 1>
                                            </#list>
                                        </div>
                                    </#list>
                                </#if>

                                <#if (otherArticleList?size % 4) != 0>
                                    <div class="row">
                                        <#list 1 .. (otherArticleList?size - index) as i>
                                            <div class="col-lg-3 col-md-12">
                                                <a href="fiction/${otherArticleList[index][0]}" class="mr-5">${otherArticleList[index][1]}(<span class="pffontext">${otherArticleList[index][2]}</span>)</a>
                                            </div>
                                            <#assign index = index + 1>
                                        </#list>
                                    </div>
                                </#if>
                            </div>
                        <#else>
                            <div class="card-body" style="margin:0 auto;">
                                <button class="btn btn-sm btn-flat">暂无</button>
                                <button class="btn btn-sm btn-warning" onclick="fictionOnReportArticle(this);">上报作品</button>
                            </div>
                        </#if>
                    </div>

                    <div class="card">
                        <div class="card-header">
                            <i class="far fa-question-circle mr-2"></i>您也许感兴趣
                        </div>
                        <div class="card-body">
                            <#assign rowCount = (maybeInterest?size / 4)?int>
                            <#assign index = 0>
                            <#if (rowCount > 1)>
                                <#list 1 .. rowCount as i>
                                    <div class="row">
                                        <#list 1 .. 4 as j>
                                            <div class="col-lg-3 col-md-12">
                                                <a href="fiction/${maybeInterest[index][0]}" class="mr-5">${maybeInterest[index][1]}(<span class="pffontext">${maybeInterest[index][2]}</span>)</a>
                                            </div>
                                            <#assign index = index + 1>
                                        </#list>
                                    </div>
                                </#list>
                            </#if>

                            <#if (maybeInterest?size % 4) != 0>
                                <div class="row">
                                    <#list 1 .. (maybeInterest?size - index) as i>
                                        <div class="col-lg-3 col-md-12">
                                            <a href="fiction/${maybeInterest[index][0]}" class="mr-5">${maybeInterest[index][1]}(<span class="pffontext">${maybeInterest[index][2]}</span>)</a>
                                        </div>
                                        <#assign index = index + 1>
                                    </#list>
                                </div>
                            </#if>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header">
                            <i class="far fa-thumbs-up mr-2"></i>同类精品
                        </div>
                        <div class="card-body">
                            <#assign rowCount = (choicest?size / 4)?int>
                            <#assign index = 0>
                            <#if (rowCount > 1)>
                            <#list 1 .. rowCount as i>
                                <div class="row">
                                    <#list 1 .. 4 as j>
                                        <div class="col-lg-3 col-md-12">
                                            <a href="fiction/${choicest[index][0]}" class="mr-5">${choicest[index][1]}(<span class="pffontext">${choicest[index][2]}</span>)</a>
                                        </div>
                                        <#assign index = index + 1>
                                    </#list>
                                </div>
                            </#list>
                            </#if>

                            <#if (choicest?size % 4) != 0>
                                <div class="row">
                                <#list 1 .. (choicest?size - index) as i>
                                    <div class="col-lg-3 col-md-12">
                                        <a href="fiction/${choicest[index][0]}" class="mr-5">${choicest[index][1]}(<span class="pffontext">${choicest[index][2]}</span>)</a>
                                    </div>
                                    <#assign index = index + 1>
                                </#list>
                                </div>
                            </#if>
                        </div>
                    </div>
                    <div class="card direct-chat direct-chat-primary">
                        <div class="card-header ui-sortable-handle" style="cursor: move;">
                            <i class="far fa-comments mr-2"></i>讨论
                            <div class="card-tools">
                                <span data-toggle="tooltip" title="3 New Messages" class="badge badge-primary">${messageCount}</span>
                                <button type="button" class="btn btn-tool" data-card-widget="collapse">
                                    <i class="fas fa-minus"></i>
                                </button>
                                <button type="button" class="btn btn-tool" data-card-widget="remove">
                                    <i class="fas fa-times"></i>
                                </button>
                            </div>
                        </div>
                        <#if (discussionList?size > 0)>
                            <div class="card-body">
                                <div class="direct-chat-messages" style="height:588px;">
                                    <#if isLogin>
                                        <span style="display: none" id="fiction-current_user">${userId}</span>
                                    </#if>
                                    <#list discussionList as row>
                                        <div class="direct-chat-msg pb-2" style="border-bottom: 1px dotted #dfdfdf">
                                            <div class="direct-chat-infos clearfix">
                                                <a class="nav-link p-0" data-toggle="dropdown" href="#">
                                                    <span class="direct-chat-name float-left text-info"><u>${row[0]}</u></span>
                                                    <span id="fiction-message-creator" style="display: none">${row[1]}</span>
                                                </a>
                                                <span class="direct-chat-timestamp float-right ml-5 d-none d-md-inline">${row[2]}</span>
                                                <span class="float-right mr-5">
                                                    ${row[5]}
                                                </span>
                                                <#if row[7] == 'up'>
                                                    <i commentid='${row[4]}' class="fas fa-thumbs-up float-right mr-2 text-danger" style="cursor: pointer" onclick="fictionOnThumpupClick(this);return false;"></i>
                                                <#else>
                                                    <i commentid='${row[4]}' class="fas fa-thumbs-up float-right mr-2" style="cursor: pointer" onclick="fictionOnThumpupClick(this);return false;"></i>
                                                </#if>
                                                <span class="float-right mr-5">
                                                    ${row[6]}
                                                </span>
                                                <#if row[7] == 'down'>
                                                    <i commentid='${row[4]}' class="fas fa-thumbs-down float-right mr-2 text-success" style="cursor: pointer" onclick="fictionOnThumpdownClick(this);return false;"></i>
                                                <#else>
                                                    <i commentid='${row[4]}' class="fas fa-thumbs-down float-right mr-2" style="cursor: pointer" onclick="fictionOnThumpdownClick(this);return false;"></i>
                                                </#if>
                                            </div>
                                            <img class="direct-chat-img" src="dist/img/user-128x128.png" alt="message user image">
                                            <div class="direct-chat-text">
                                                ${row[3]}
                                            </div>
                                        </div>
                                    </#list>
                                </div>
                            </div>
                        <#else>
                            <div class="card-body" style="margin:0 auto;">
                                <buton class="btn btn-lg btn-flat">暂无讨论的内容</buton>
                            </div>
                        </#if>
                        <#if isLogin>
                            <div class="card-footer">
                                <div class="row">
                                    <div class="col-12">
                                        <div class="form-group">
                                            <textarea id="use-content" class="form-control" rows="4" placeholder="这里可以输入您的讨论"></textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-lg-4 col-md-12">
                                        <div>
                                            <input id="input-captcha" class="form-control" placeholder="输入上面看到的字符(验证码)">
                                            <button class="btn btn-sm btn-outline-primary mt-3" onclick="fictionOnPublishButtonClick();">发送</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <#else>
                            <div class="card-footer mt-3">
                                <button class="btn btn-danger" onclick="fictionOnDiscussClick();">点击登录，参与评论</button>
                            </div>
                        </#if>
                    </div>

                </section>
            </div>
            <#--  right column  -->
            <div class="col-lg-2" style="background: #b3b3b3;">

            </div>
        </div>
    </div>

    <div id="score-poper-frame" class="p-2" style="background-color: #001f3f; border: 1px solid lightblue; border-radius: 7px;">
        <div class="mt-2">
            <small class="text-light">请输入您的评分（1到10分，可以是小数）</small>
        </div>
        <div class="input-group mt-1">
            <input type="text" class="form-control rounded-0" placeholder="例子：9 或者 9.8" id="fiction-input-score">
            <span class="input-group-append">
                <button type="button" class="btn btn-warning btn-flat" onclick="fictionOnSubmitScore();return false;">提交</button>
            </span>
        </div>
    </div>
    <#include "./footer.ftl">
</div>

<script src="admin/plugins/jquery/jquery.min.js"></script>
<script src="admin/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="admin/plugins/datatables/jquery.dataTables.js"></script>
<script src="admin/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<script src="admin/plugins/sweetalert2/sweetalert2.all.min.js"></script>
<script src="admin/plugins/tipped/js/tipped.min.js"></script>
<script src="admin/plugins/toastr/toastr.min.js"></script>
<script src="admin/plugins/jquery-realperson/jquery.plugin.js"></script>
<script src="admin/plugins/jquery-realperson/jquery.realperson.js"></script>
<script src="admin/js/adminlte.min.js"></script>
<script src="plugin/popper.min.js"></script>
<script src="utility.js"></script>
<script src="script/page/fiction.js"></script>
</body>
</html>
